<template>
  <div class="header">
    <div class="left">
      <van-icon
        name="arrow-left"
        @click="goback"
        v-if="this.$route.meta.arrowLeft"
      />
      <van-icon name="apps-o" class="main-icon" v-else />
      <span class="title">{{ this.$route.meta.title }}</span>
    </div>
    <div class="center">
      <div v-if="this.$route.meta.center1" class="center1">
        <van-icon name="search" size="16" />
        <input type="text" @focus="$router.push('/search/main')" />
      </div>
      <div class="center2" v-if="this.$route.meta.center2">
        <!-- <ul v-for="(item, index) in this.$route.meta.headerList" :key="index">
          <li :class="{ light: index == id }" @click="light(index, item.path)">
            {{ item.tit }}
          </li>
        </ul> -->
        <ul v-if="this.$route.meta.showPlay">
          <li><router-link to="/play/listen">听听</router-link></li>
          <li><router-link to="/play/recommend">推荐</router-link></li>
          <li><router-link to="/play/classify">分类</router-link></li>
        </ul>
        <ul v-else>
          <li><router-link to="/focus/dynamic">动态</router-link></li>
          <li><router-link to="/focus/cloud">云圈</router-link></li>
        </ul>
      </div>
    </div>
    <div class="right">
      <van-icon name="ellipsis" />
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      fixed: true,
      value1: "",
      id: "",
    };
  },
  computed: {},
  watch: {},
  methods: {
    //返回上一页
    goback() {
      this.$router.go(-1);
    },
    //点击高亮
    // async light(index, path) {
    //   this.id = index;
    //   console.log(path);
    //   await this.$router
    //     .push({
    //       path: path,
    //     })
    //     .catch((err) => {
    //       console.log(err);
    //     });
    // },
  },
  created() {},
  mounted() {},
  components: {},
};
</script>
<style scoped>
.header {
  height: 50px;
  background: #fff;
  padding: 0 10px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.left,
.right {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}
.center {
  flex: 1;
}
.center1 {
  height: 28px;
  border-radius: 15px;
  margin: 0 8px;
  display: flex;
  align-items: center;
  background: rgb(243, 243, 243);
  padding: 0 10px;
  box-sizing: border-box;
}
.center1 input {
  width: 180px;
  border: none;
  background: rgb(243, 243, 243);
  padding-left: 5px;
}
.center2 ul {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* .center2 li {
  width: 55px;
  text-align: center;
  font-size: 15px;
  color: rgb(43, 42, 42);
}
.center2 .light {
  color: rgb(243, 4, 4);
  font-size: 16px;
  font-weight: bold;
} */
.van-icon {
  font-size: 20px;
}
.title {
  font-size: 15px;
  margin-left: 5px;
}
ul li {
  width: 45px;
}
ul li a {
  color: #000;
}
.active {
  font-size: 17px;
  font-weight: bold;
  position: relative;
}
.active::before {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 36px;
  height: 5px;
  border-radius: 5px;
  background: red;
}
</style>
